//-------------------------------------------------------------
// \project PluginExample1
// \file Module1.java
// \brief 模块类1
// \author 王庆飞
// \date 2016-4-14
// \attention
// Copyright(c) 超图软件股份有限公司 气象事业部
// All Rights Reserved
// \version 1.0
//-------------------------------------------------------------

package com.mg.pluginexample1;

import java.util.ArrayList;
import java.util.LinkedList;

import com.mg.model.*;

public class Module1 extends Module 
{
	public Module1(int nID) 
	{
		super(nID);
		
		m_alInputPort.add(new Port(this));
		m_alInputPort.add(new Port(this));
		m_alInputPort.add(new Port(this));
		m_alOutputPort.add(new Port(this));
    }

	public String GetGroupName()
	{
		return "示例分组1";
	}
	public String GetName()
	{
		return "示例模块1";
	}
	public String GetDescription()
	{
		return "模块1描述。";
	}
	
	public boolean OnAttach(Port portFrom, Port portTo)
	{
		return true;
	}
	
	public boolean Execute()
	{
		m_model.OutputLog(Model.LogLevel.Debug, "Module1.Execute()");
		return true;
	}
	
	public int GetOutputParam(Port port, ArrayList<Param> alParam)
	{
		int i = FindPort(port, false);
		if (i == -1)
			return 0;
		if (i == 0)
		{
			//--------------------------------------------------------------------
			//test ModuleImportPoint
			LinkedList<String> ll = new LinkedList<String>();
			ll.add("StationNum,x,y,z,value");
			ll.add("VARCHAR,DOUBLE,DOUBLE,DOUBLE,FLOAT");
			ll.add("0001,110.0,30.0,500.0,10.0");
			ll.add("0002,110.2,30.5,510.0,20.0");
			ll.add("0003,111.2,25.5,400.0,30.0");
			
			alParam.add(new Param("CSV", ll));
			//--------------------------------------------------------------------
		}
		
		return alParam.size();
	}
}
